import api from './index'
import type { Comment } from '@/models/comment.model'
import { TABLE_INDEX } from './user'

// 获取文章评论
export const getArticleComments = (articleId: string) => {
  return api.get('/getallitems', { 
    params: { 
      typeIndex: TABLE_INDEX.COMMENTS,
      articleId
    } 
  })
}

// 添加评论
export const addComment = (comment: Comment) => {
  return api.post('/additem', { ...comment, typeIndex: TABLE_INDEX.COMMENTS })
}